<?php if ($type == 0): ?>
<?php $c=0; foreach ($jobs as $jobOrder):
	$job = $jobOrder['order'];
	$routes = $jobOrder['routes'];
?>
<div class="wrapper-world job-<?php echo (($c%2 == 0) ? "odd" : "even"); if ($job->muser == 1) { echo "  job-orange"; } ?>">
	<div class="wrapper">
		<div class="job-id"><?php echo $this->Jobs->getID($job); ?></div>
		<div class="job-details">
			<?php //if ($job->type == "2"): ?>
			
			<?php $c1 = 0; foreach ($routes as $route): ?>
				<?php if ($c1 > 0): ?><br /><?php else: $c1++; endif; ?>
				<?php echo nl2br($this->Jobs->formatJobInfo($route)); ?>
			<?php endforeach; ?></div>
		<div class="job-status"><?php echo (($job->cancel == 1) ? "Cancel request" : constant("JOB_STATUS_". $job->status)); ?></div>
		<div class="job-price"><?php echo (($job->price > 0) ? $this->Jobs->formatPrice($job->price) : "&ndash;");?></div>
		<div class="job-action">
			<?php echo $this->Jobs->showActionLinks($job, "oncoming"); ?>
		</div>
		<div class="clr"></div>
	</div>
</div>
<?php $c++; endforeach; ?>
<?php elseif ($type == 1): ?>
<?php $c=0; foreach ($jobs as $jobOrder):
	$job = $jobOrder['order'];
	$routes = $jobOrder['routes'];
?>
<div class="wrapper-world job-<?php echo (($c%2 == 0) ? "odd" : "even"); if ($job->muser == 1) { echo "  job-orange"; } ?>">
	<div class="wrapper">
		<div class="job-id"><?php echo $this->Jobs->getID($job); ?></div>
		<div class="job-details">
			<?php $c1 = 0; foreach ($routes as $route): ?>
				<?php if ($c1 > 0): ?><br /><?php else: $c1++; endif; ?>
				<?php echo nl2br($this->Jobs->formatJobInfo($route)); ?>
			<?php endforeach; ?></div>
		<div class="job-status">Draft</div>
		<div class="job-price">&ndash;</div>
		<div class="job-action"><?php echo $this->Jobs->showActionLinks($job, "drafts"); ?></div>
		<div class="clr"></div>
	</div>
</div>
<?php $c++; endforeach; ?>
<?php elseif ($type == 2): ?>
<?php $c=0; foreach ($overdue as $jobOrder):
	$job = $jobOrder['order'];
	$routes = $jobOrder['routes'];
?>
<div class="wrapper-world job-<?php echo (($c%2 == 0) ? "odd" : "even"); if ($job->muser == 1) { echo "  job-orange"; } else { echo " job-red"; } ?>">
	<div class="wrapper">
		<div class="job-id"><?php echo $this->Jobs->getID($job); ?></div>
		<div class="job-details">
			<?php $c1 = 0; foreach ($routes as $route): ?>
				<?php if ($c1 > 0): ?><br /><?php else: $c1++; endif; ?>
				<?php echo nl2br($this->Jobs->formatJobInfo($route)); ?>
			<?php endforeach; ?></div>
		<div class="job-date"><?php echo date('d M Y', strtotime($job->duedate)); ?></div>
		<div class="job-price"><?php echo $this->Jobs->formatPrice($job->price); ?></div>
		<div class="job-paid"><?php echo $this->Jobs->formatPrice($job->paid); ?></div>
		<div class="job-left"><?php echo $this->Jobs->formatPrice($job->price-$job->paid); ?></div>
		<div class="job-action"><?php echo $this->Jobs->showActionLinks($job, "overdue"); ?></div>
		<div class="clr"></div>
	</div>
</div>
<?php $c++; endforeach; ?>

<?php

/** phpnew comment this block

<?php $c=0; foreach ($due as $jobOrder):
	$job = $jobOrder['order'];
	$routes = $jobOrder['routes'];
?>
<div class="wrapper-world job-<?php echo (($c%2 == 0) ? "odd" : "even"); if ($job->muser == 1) { echo "  job-orange"; } ?>">
	<div class="wrapper">
		<div class="job-id"><?php echo $this->Jobs->getID($job); ?></div>
		<div class="job-details">
			<?php $c1 = 0; foreach ($routes as $route): ?>
				<?php if ($c1 > 0): ?><br /><?php else: $c1++; endif; ?>
				<?php echo nl2br($this->Jobs->formatJobInfo($route)); ?>
			<?php endforeach; ?></div>
		<div class="job-date"><?php echo date('d M Y', strtotime($job->duedate)); ?></div>
		<div class="job-price"><?php echo $this->Jobs->formatPrice($job->price); ?></div>
		<div class="job-paid"><?php echo $this->Jobs->formatPrice($job->paid); ?></div>
		<div class="job-left"><?php echo $this->Jobs->formatPrice($job->price-$job->paid); ?></div>
		<div class="job-action"><?php echo $this->Jobs->showActionLinks($job, "due"); ?></div>
		<div class="clr"></div>
	</div>
</div>
<?php $c++; endforeach; ?>
*/
?>

<?php elseif ($type == 3): ?>
<?php $c=0; foreach ($jobs as $jobOrder):
	$job = $jobOrder['order'];
	$routes = $jobOrder['routes'];
?>
<div class="wrapper-world job-<?php echo (($c%2 == 0) ? "odd" : "even"); ?>">
	<div class="wrapper">
		<div class="job-id"><?php echo $this->Jobs->getID($job); ?></div>
		<div class="job-details">
			<?php $c1 = 0; foreach ($routes as $route): ?>
				<?php if ($c1 > 0): ?><br /><?php else: $c1++; endif; ?>
				<?php echo nl2br($this->Jobs->formatJobInfo($route)); ?>
			<?php endforeach; ?>
		</div>
		<div class="job-date"><?php echo $job->date; ?></div>
		<div class="job-price"><?php echo (($job->price > 0) ? $this->Jobs->formatPrice($job->price) : "&ndash;");?></div>
		<div class="job-action"><?php echo $this->Jobs->showActionLinks($job, "completed"); ?></div>
		<div class="clr"></div>
	</div>
</div>
<?php $c++; endforeach; ?>
<?php elseif ($type == 4): ?>
<?php $c=0; foreach ($jobs as $jobOrder):
	$job = $jobOrder['order'];
	$routes = $jobOrder['routes'];
?>
<div class="wrapper-world job-<?php echo (($c%2 == 0) ? "odd" : "even"); ?>">
	<div class="wrapper">
		<div class="job-id"><?php echo $this->Jobs->getID($job); ?></div>
		<div class="job-details">
			<?php $c1 = 0; foreach ($routes as $route): ?>
				<?php if ($c1 > 0): ?><br /><?php else: $c1++; endif; ?>
				<?php echo nl2br($this->Jobs->formatJobInfo($route)); ?>
			<?php endforeach; ?>
		</div>
		<div class="job-status"><?php echo constant("JOB_STATUS_". $job->status); ?></div>
		<div class="job-price"><?php echo (($job->price > 0) ? $this->Jobs->formatPrice($job->price) : "&ndash;");?></div>
		<div class="job-action"><?php echo $this->Jobs->showActionLinks($job, "cancelled"); ?></div>
		<div class="clr"></div>
	</div>
</div>
<?php $c++; endforeach; ?>
<?php endif; ?>